package com.shop.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.shop.entity.BulkMerchant;
import com.shop.entity.Order;
import com.shop.entity.OrderDetails;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface MerchantOrderMapper extends BaseMapper<Order> {
    List<Order> getOrderListByMerchantId(Integer merchantId);

    //高级索引
    List<BulkMerchant> superSearch(String superSearchKeyWord);
    //条件查询
    List<BulkMerchant> queryAllByModel(BulkMerchant model);

    OrderDetails getOrderDetailsListByOrderId(Integer id);

    Integer updateOne(Order order);

    @Select("SELECT id,no,total_price,`status`,create_time,count(create_time) FROM `order` WHERE merchant_id=#{merchantId} AND `status`=5 AND DATE_SUB(CURDATE(),INTERVAL 7 DAY)<=date(create_time) GROUP BY id")
    List<Order> getTotalSalePriceByMerchantId(Integer merchantId);
}
